<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">


    <title>项目/项目版本控制</title>

    <%--<link rel="shortcut icon" href="favicon.ico">--%>
    <link href="<c:url value="/resources/hplus/lib/css/bootstrap.min.css?v=3.3.6"/>" rel="stylesheet">
    <link href="<c:url value="/resources/hplus/lib/css/font-awesome.css?v=4.4.0"/>" rel="stylesheet">

    <!-- Sweet Alert -->
    <link href="<c:url value="/resources/hplus/lib/css/plugins/sweetalert/sweetalert.css"/>" rel="stylesheet">

    <!-- jqgrid-->
    <link href="<c:url value="/resources/hplus/lib/css/plugins/jqgrid/ui.jqgrid.css?0820"/>" rel="stylesheet">

    <link href="<c:url value="/resources/hplus/lib/css/animate.css"/>" rel="stylesheet">
    <link href="<c:url value="/resources/hplus/lib/css/style.css?v=4.1.0"/>" rel="stylesheet">
    <link href="<c:url value="/resources/layui/css/layui.css"/>" rel="stylesheet">

    <style>
        .ui-jqgrid tr.jqgrow td
        {
            /* jqGrid cell content wrap  */
            white-space: normal !important;
            height :auto;
        }

        th.ui-th-column div
        {
            /* jqGrid columns name wrap  */
            white-space:normal !important;
            height:auto !important;
            padding:0px;
        }
    </style>

</head>

<body class="gray-bg">
<div class="wrapper wrapper-content  animated fadeInRight" style="max-width: 80%;margin-left: 10%;">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox ">
                <div class="ibox-title">
                    <!--<h5>jQuery Grid Plugin – jqGrid</h5>-->
                    <div class="form-group" style="margin-bottom: 40px;">
                        <div class="col-sm-10">
                            <form role="form" class="form-inline">
                                <div class="form-group">
                                    <label for="projectName" class="sr-only">项目名称：</label>
                                    <input id="projectName" type="text" placeholder="项目名称" class="form-control">
                                </div>
                                <div class="form-group">
                                    <label for="proManager" class="sr-only">项目经理：</label>
                                    <input id="proManager" type="text" placeholder="项目经理" class="form-control">
                                </div>
                                <button id="searchButton" type="button" class="btn btn-primary">
                                    搜索
                                </button>
                            </form>
                        </div>
                    </div>
                </div>

                <div class="ibox-content">
                    <!--<h4 class="m-t">高级用法</h4>-->

                    <div class="jqGrid_wrapper">
                            <table id="grid_table"></table>
                        <div id="grid_pager"></div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<!-- 全局js -->
<script src="<c:url value="/resources/hplus/lib/js/jquery.min.js?v=2.1.4"/>"></script>
<script src="<c:url value="/resources/hplus/lib/js/bootstrap.min.js?v=3.3.6"/>"></script>



<!-- Peity -->
<script src="<c:url value="/resources/hplus/lib/js/plugins/peity/jquery.peity.min.js"/>"></script>

<!-- jqGrid -->
<script src="<c:url value="/resources/hplus/lib/js/plugins/jqgrid/i18n/grid.locale-cn.js?0820"/>"></script>
<script src="<c:url value="/resources/hplus/lib/js/plugins/jqgrid/jquery.jqGrid.min.js?0820"/>"></script>


<!-- layer javascript -->

<script src="<c:url value="/resources/hplus/lib/js/plugins/layer/laydate/laydate.js"/>"></script>


<!-- Page-Level Scripts -->
<script>
    $(document).ready(function () {

        $.jgrid.defaults.styleUI = 'Bootstrap';

        var grid_table = "#grid_table";
        var grid_pager = "#grid_pager";

        $(grid_table).jqGrid({
            url:"<c:url value="/web/listJson.json"/>",
            mtype: "POST",
            datatype: "json",
            height: 450,
            autowidth: true,
            shrinkToFit: true,
            rowNum: -1,
            rowList: [10, 20, 50],
            colNames: ['序号', '更新时间', '项目名称', '项目经理', '开发经理', '当前版本', '发布时间','下一个版本', '计划发布时间', '操作'],
            colModel: [
                {name: 'id', hidden:true, index: 'id',width:40,  align:'left', editable: true, sortable:true, sorttype: "int", search:false},
                {name: 'createTime',hidden:true,  index: 'createTime', align:'left', editable: true, sortable:true, sorttype: "date",search:false},
                {name: 'proName', index: 'proName',width:260, editable: true,  align:'left',sortable:false},
                {name: 'proManager', index: 'proManager', editable: true, align:'left',sortable:false},
                {name: 'devManager', index: 'devManager', editable: true, align:'left',sortable:false},
                {name: 'currentVersion', index: 'currentVersion', editable: true, align:'left',sortable:false},
                {name: 'publishTime', index: 'publishTime', editable: true, align:'left',sortable:false},
                {name: 'nextVersion', index: 'nextVersion', editable: true, align:'left',sortable:false},
                {name: 'nextPublishTime', index: 'nextPublishTime', editable: true, align:'left',sortable:false},
                {name:'action',index:'action', label:"操作", align:'left', editable: false,search:false, sortable:false,width:200}
            ],
            pager: '',
            pgbuttons: false,
            pginput:false,
            viewrecords: true,
//            caption: "jqGrid 示例2",
            add: true,
            edit: true,
            addtext: 'Add',
            edittext: 'Edit',
            hidegrid: false,
            gridComplete: function() {
                var ids = $(grid_table).jqGrid('getDataIDs');

                for (var i = 0; i < ids.length; i++) {
                    var proName = $(grid_table).jqGrid('getRowData',ids[i]).proName;
                    $(grid_table).jqGrid('setRowData', ids[i], {
                      action :  "<button class='btn btn-xs btn-info edit' style='width:80px;height: 27px;' id='editPage_" + ids[i] + "' onclick='detail(" + ids[i] + ")'><i class='fa fa-cube'></i>"+"&nbsp;版本信息"+"</button>"

                       // "&nbsp;&nbsp;<button class='btn btn-xs btn-info del' style='width:80px;height: 27px;' id='del_" + ids[i] + "' onclick='del(" + ids[i] + ",\"" + proName + "\")'><i class='fa fa-times'></i>"+"删除"+"</button>"
                    });
                }
            }
        });

        // reload data table
        // jQuery(grid_table).jqGrid('setGridParam', {postData:getQueryData(), page:1}).trigger("reloadGrid");

        // Add selection
        $(grid_table).setSelection(4, true);

        // Setup buttons
        $(grid_table).jqGrid('navGrid', grid_pager, {
            edit: false,
            add: false,
            del: false,
            search: false
        }, {
            height: 200,
            reloadAfterSubmit: true
        });

        // Add responsive to jqGrid
        $(window).bind('resize', function () {
            var width = $('.jqGrid_wrapper').width();
            $(grid_table).setGridWidth(width);
        });

        var icon = "<i class='fa fa-times-circle'></i> ";


        /**
         * 条件搜索
         * */
        $('#searchButton').click(function () {
            var projectName = $('#projectName').val();
            var proManager = $('#proManager').val();
            $('#grid_table').jqGrid('setGridParam', {
                postData: {'projectName': projectName, 'proManager': proManager} //发送搜索条件
               // page: 1
            }).trigger("reloadGrid"); //重新载入
        });
    });

    var _addr_sub_opr = "add";

    function detail(id) {
       window.location.href = "<c:url value="/web/version_"/>" + id + ".html";
    }


</script>

<!--<script type="text/javascript" src="http://tajs.qq.com/stats?sId=9051096" charset="UTF-8"></script>-->
<!--统计代码，可删除-->

</body>

</html>